Skip to content

Deprecate cirq.SingleQubitGate #5272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Apr 21, 2022
Merged

Deprecate cirq.SingleQubitGate #5272

merged 14 commits into from
Apr 21, 2022

Conversation

vtomole
Copy link
Collaborator

@vtomole vtomole commented Apr 20, 2022

Fixes #4790

@CirqBot CirqBot added the size: L 250< lines changed <1000 label Apr 20, 2022
@vtomole vtomole marked this pull request as ready for review April 20, 2022 02:38
@vtomole vtomole requested review from mrwojtek, a team, cduck, wcourtney and verult as code owners April 20, 2022 02:38
@vtomole vtomole requested a review from 95-martin-orion April 20, 2022 02:38
@vtomole vtomole requested a review from dstrain115 April 20, 2022 16:11
Copy link
Collaborator

@95-martin-orion 95-martin-orion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this will break any external code relying on isinstance(gate, SingleQubitGate) to work for Cirq gates. @tanujkhattar, @maffoo, are we okay with this? I imagine doing this in a backwards-compatible way could be convoluted...and we might not have the cycles left before 1.0 to fit it in.

@daxfohl
Copy link
Collaborator

daxfohl commented Apr 20, 2022

https://github.com/quantumlib/Cirq/pull/4207/files#diff-ca28027a48663798185c7ace310bbfa90b231d4afa96fafebda9a1d2cb05a322 for an example of how to preserve behavior of e.g. isinstance(X, SingleQubitGate) == True (with a warning message) even after X no longer inherits SingleQubitGate. Of course it's a slight behavior change in that any one-qubit gate will return True there, but better than nothing.

Copy link
Collaborator

@95-martin-orion 95-martin-orion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready to go % one docs nit.

def _pad_tableau(
clifford_tableau: qis.CliffordTableau, num_qubits_after_padding: int, axes: List[int]
) -> qis.CliffordTableau:
"""Roughly, this function copies self.tabluea into the "identity" matrix."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.tabluea -> self.tableau

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@vtomole vtomole added automerge Tells CirqBot to sync and merge this PR. (If it's running.) and removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) labels Apr 21, 2022
@vtomole
Copy link
Collaborator Author

vtomole commented Apr 21, 2022

Updated the Note: in known_devices.py to reflect the updated single_qubit_gates check.

@vtomole vtomole added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Apr 21, 2022
@CirqBot
Copy link
Collaborator

CirqBot commented Apr 21, 2022

Automerge cancelled: A required status check is not present.

Missing statuses: ['Build docs', 'Build protos', 'Coverage check', 'Pytest MacOS (3.7)', 'Pytest MacOS (3.8)', 'Pytest MacOS (3.9)', 'Pytest Windows (3.7)', 'Pytest Windows (3.8)', 'Pytest Windows (3.9)', 'Typescript lint check', 'Typescript tests', 'Typescript tests coverage']

@CirqBot CirqBot removed the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Apr 21, 2022
@vtomole vtomole added automerge Tells CirqBot to sync and merge this PR. (If it's running.) and removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) labels Apr 21, 2022
@vtomole vtomole added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Apr 21, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Apr 21, 2022
@CirqBot
Copy link
Collaborator

CirqBot commented Apr 21, 2022

Automerge cancelled: A required status check is not present.

Missing statuses: ['Build docs', 'Build protos', 'Changed files test', 'Coverage check', 'Doc test', 'Format check', 'Lint check', 'Misc check', 'Notebook formatting', 'Pytest MacOS (3.7)', 'Pytest MacOS (3.8)', 'Pytest MacOS (3.9)', 'Pytest Ubuntu (3.7)', 'Pytest Ubuntu (3.8)', 'Pytest Ubuntu (3.9)', 'Pytest Windows (3.7)', 'Pytest Windows (3.8)', 'Pytest Windows (3.9)', 'Type check', 'Typescript lint check', 'Typescript tests', 'Typescript tests coverage']

@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Apr 21, 2022
@vtomole vtomole added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Apr 21, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Apr 21, 2022
@CirqBot CirqBot merged commit e7233bb into master Apr 21, 2022
@CirqBot CirqBot removed the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Apr 21, 2022
@CirqBot CirqBot deleted the deprecate_single_qubit_gate branch April 21, 2022 17:42
@CirqBot CirqBot removed the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Apr 21, 2022
tonybruguier pushed a commit to tonybruguier/Cirq that referenced this pull request Apr 22, 2022
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: L 250< lines changed <1000
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate SingleQubitGate
4 participants